<?php
class CollectionServer {
	public function collection($userId,$teacherId){
		$teache = HttpDaoManager::getCollectionDao()->searchList(array('user_id'=>$userId,'teacher_id'=>$teacherId));
		if (empty($teache)){
			$data = array(
				'add_time' => time(),
				'user_id' =>$userId,
				'teacher_id' => $teacherId
			);
			HttpDaoManager::getCollectionDao()->add($data);
		}
	}
	public function getCollectoinTeacherList($userId){
		$tmp = HttpDaoManager::getCollectionDao()->searchList(array('user_id'=>$userId));
	
		$idArray= array();
		foreach ($tmp as $v){
			$idArray[] = $v['teacher_id'];
		}
		$id = implode(',',$idArray);
		$favourable_teacher_list = array();
		if(!empty($id)){
			$favourable_teacher_list = HttpDaoManager::getTeacherDao()->searchList(array('id'=>array($id,'in')));
		}
		return $favourable_teacher_list;
		
	}
}

?>